package tv.youxing.android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import tv.youxing.android.R;
import tv.youxing.android.entity.AlbumVideoModel;

/**
 * Created by apple on 2017/4/24.
 */

/**
 * 项目名：   youxing
 * 包名：     tv.youxing.android .adapter
 * 文件名：   BatchDownloadAdapter
 * 创建者：   叶克武
 * 创建时间： 2017/4/24 上午10:09
 * 描述：    TODO
 */
public class BatchDownloadAdapter extends BaseAdapter {

    private Context context;
    private List<AlbumVideoModel> batchDownloadList = new ArrayList<>();
    private LayoutInflater layoutInflater;


    public BatchDownloadAdapter(Context context, List<AlbumVideoModel> batchDownloadList) {
        this.context = context;
        this.batchDownloadList = batchDownloadList;
        this.layoutInflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
    }


    @Override
    public int getCount() {
        return batchDownloadList.size();
    }

    @Override
    public Object getItem(int position) {
        return batchDownloadList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (viewHolder==null) {
            viewHolder = new ViewHolder();
            convertView = layoutInflater.inflate(R.layout.layout_item_batch_download, null);
            viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.tvTitle);
            viewHolder.ivDownloadStatus = (ImageView) convertView.findViewById(R.id.ivDownloadStatus);
            convertView.setTag(viewHolder);
        }else{
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.tvTitle.setText("奥斯卡颁奖如何真钱游戏");
        viewHolder.ivDownloadStatus.setImageResource(R.drawable.batch_icon_download_pre);

        return convertView;
    }


    class ViewHolder{
        private TextView tvTitle;
        private ImageView ivDownloadStatus;
    }



}
